// ---------------------------------------------------------------------------

#ifndef MainFormH
#define MainFormH
// ---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <IniFiles.hpp>
#include "IdBaseComponent.hpp"
#include "IdComponent.hpp"
#include "IdHTTP.hpp"
#include "IdTCPClient.hpp"
#include "IdTCPConnection.hpp"
#include "IdHash.hpp"
#include "IdHashMessageDigest.hpp"
#include "ConfigQuery.cpp"
#include <XMLDoc.hpp>
#include <msxmldom.hpp>
#include <ComCtrls.hpp>
#include "dxGDIPlusClasses.hpp"
#include <ExtCtrls.hpp>
#include <map>
#include "HttpThread.h"
// ---------------------------------------------------------------------------
using namespace std;

class TUMainForm : public TForm {
__published: // IDE-managed Components
	TIdHTTP *http;
	TProgressBar *ProgressBar;
	TLabel *StatusLabel;
	TLabel *InfoLabel;
	TImage *img;
	TLabel *TitleLabel;
	void __fastcall httpStatus(TObject *ASender, const TIdStatus AStatus,
		const UnicodeString AStatusText);
	void __fastcall httpWork(TObject *ASender, TWorkMode AWorkMode,
		__int64 AWorkCount);
	void __fastcall httpWorkBegin(TObject *ASender, TWorkMode AWorkMode,
		__int64 AWorkCountMax);
	void __fastcall httpWorkEnd(TObject *ASender, TWorkMode AWorkMode);
	void __fastcall FormShow(TObject *Sender);

private: // User declarations
	String server;
	String port;
	String version;
	String lastVersion;

	int totleSize;

	int downloadIndex;

	map<String, String>list;

	void __fastcall SetConfig();

	void __fastcall LoadConfig();

	bool __fastcall IsLastVersion();

	void __fastcall Update();

	String __fastcall GetUrl(int type);

	String __fastcall GetFileUrl(String folder, String file);

	void __fastcall StartUp();

public: // User declarations
	__fastcall TUMainForm(TComponent* Owner);

	void __fastcall UpdateComplete();
};

// ---------------------------------------------------------------------------
extern PACKAGE TUMainForm *UMainForm;
// ---------------------------------------------------------------------------
#endif
